const { DataTypes } = require("sequelize");
const seq = require("../db/seq.js");
const Stations = seq.define(
  "stations",
  {
    stationId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      autoIncrement:true,
      primaryKey: true,
      comment: "变电站ID",
    },
    stationName: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue:'',
      comment: "变电站名称",
    },
    voltage: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue:'',
      comment: "电压等级",
    },
    links: {
      type: DataTypes.STRING(1000),
      allowNull: false,
      defaultValue: "",
      comment: "涉及线路",
    },
    works: {
      type: DataTypes.STRING(1000),
      allowNull: false,
      defaultValue: "",
      comment: "涉及业务",
    },
    longitude: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "经度",
    },
    latitude: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "纬度",
    },
    dataFlag:{
      type:DataTypes.TINYINT,
      allowNull:false,
      defaultValue:1,
      comment:"删除标志"
    },
    R:{
      type:DataTypes.STRING(10),
      allowNull:false,
      defaultValue:"",
      comment:"RGB颜色中的红色的值"
    },
    G:{
      type:DataTypes.STRING(10),
      allowNull:false,
      defaultValue:"",
      comment:"RGB颜色中的绿色的值"
    },
    B:{
      type:DataTypes.STRING(10),
      allowNull:false,
      defaultValue:"",
      comment:"RGB颜色中的蓝色的值"
    }, 
    imageUrl:{
      type:DataTypes.STRING(100),
      allowNull:false,
      defaultValue:"",
      comment:"图片路径"
    },
    Z:{
      type:DataTypes.STRING(10),
      allowNull:false,
      defaultValue:"",
      comment:"Z坐标"
    },
  },
  {
    freezeTableName: true,
    timestamps: false,
  }
);
module.exports = Stations;